package com.yami.shop.cp.comment.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.cp.comment.dto.CPOrderDto;
import com.yami.shop.cp.comment.dto.CPSubmitPersonCount;
import com.yami.shop.cp.comment.dto.CollaborativePurchaseMergerDto;
import com.yami.shop.cp.comment.model.CollaborativePurchase;
import com.yami.shop.cp.comment.param.CPSearchParam;
import org.springframework.http.ResponseEntity;

import java.util.List;

/**
 * <p>
 * 协助采购接口
 * </p>
 *
 * @author xch
 * @since 2021-06-23
 */
public interface CollaborativePurchaseService extends IService<CollaborativePurchase> {

    /**
     * 创建协同采购单
     *
     * @param collaborativePurchaseMergerDto 采购单整体信息
     */
    void createCollaborativePurchase(CollaborativePurchaseMergerDto collaborativePurchaseMergerDto);

    /**
     * 根据用户id和协同采购单id查询采购单整体信息
     *
     * @param userId                  用户id
     * @param collaborativePurchaseId 协同采购单id
     * @return CollaborativePurchaseMergerDto
     */
    CollaborativePurchaseMergerDto queryCollaborativePurchaseMergerDto(String userId, String collaborativePurchaseId);

    /**
     * 修改协同采购单
     *
     * @param collaborativePurchaseMergerDto 采购单整体信息
     */
    void updateCollaborativePurchase(CollaborativePurchaseMergerDto collaborativePurchaseMergerDto);


    /**
     * 条件查询，分页获取协同采购单
     *
     * @param page   分页参数
     * @param userId 用户id
     * @param status 查询采购单状态
     * @return IPage<CollaborativePurchase>
     */
    IPage<CollaborativePurchase> pageByUserIdAndStatus(PageParam page, String userId, String status);

    /**
     * 根据提报人手机号查询协同采购单
     *
     * @param page   分页参数
     * @param mobile 手机号
     * @param status 状态
     * @return IPage<CollaborativePurchase>
     */
    IPage<CollaborativePurchase> pageBySubmitPersonIdAndStatus(PageParam page, String mobile, String status);

    /**
     * 根据协同采购单id查询协同采购单提报人 提报状态
     *
     * @param collaborativePurchaseId 协同采购id
     * @return List<CPSubmitPersonInfoAndSubmitStatus>
     */
    CPSubmitPersonCount getCPSubmitPersonCount(String collaborativePurchaseId);

    /**
     * 平台端搜索协同采购单号
     * @param page 分页信息
     * @param cpSearchParam 搜索信息
     * @return IPage<CollaborativePurchase>
     */
    IPage<CollaborativePurchase> getSearchCP(PageParam page, CPSearchParam cpSearchParam);

    /**
     * 平台端搜索协同采购单号
     * @param cpSearchParam 搜索信息
     * @return IPage<CollaborativePurchase>
     */
    List<CollaborativePurchase> getSearchCP(CPSearchParam cpSearchParam);

    /**
     * 根据协同采购单号获取订单号，订单创建时间和商品总数
     * @param cpId 协同采购id
     * @return List<CPOrderDto>
     */
    List<CPOrderDto> getCPOrderNumById(String cpId);
}
